
#include <iostream>

class center
{
public:
    center(int s = 0) : signal(s) {}
    void changeSignal(int x)
    {
        signal = x;
    }
    int signal;
};

center CU;

class observer1
{
public:
    void solve()
    {
        if (CU.signal == 1)
            std::cout << "observer1 is working." << std::endl;
    }
};

class observer2
{
public:
    void solve()
    {
        if (CU.signal == 2)
            std::cout << "observer2 is working." << std::endl;
    }
};

int main()
{
    CU.changeSignal(1);
    observer1 o1;
    observer2 o2;
    int ticks = 10;
    while (ticks--)
    {
        o1.solve();
        o2.solve();
        CU.changeSignal(3 - CU.signal);
    }
}